package live.zs.reactiveRoutes;

import io.quarkus.vertx.web.Route;
import io.quarkus.vertx.web.RoutingExchange;
import io.vertx.ext.web.RoutingContext;

import javax.enterprise.context.ApplicationScoped;

/**
 * @author madison
 * @description
 * @date 2022/2/5 08:59
 */
@ApplicationScoped
public class MyDeclarativeRoutes {
    @Route(methods = Route.HttpMethod.GET)
    void hello(RoutingContext rc) {
        rc.response().end("hello");
    }

    @Route(path = "/world")
    String helloWorld() {
        return "Hello world!";
    }

    @Route(path = "/greetings", methods = Route.HttpMethod.GET)
    void greetings(RoutingExchange ex) {
        ex.ok("hello " + ex.getParam("name").orElse("world"));
    }
}
